var Redis = require("ioredis");

var cluster = new Redis.Cluster([{
        port: 8001,
        host: "127.0.0.1"
    },
    {
        port: 8002,
        host: "127.0.0.1"
    }, {
        port: 8003,
        host: "127.0.0.1"
    }, {
        port: 8004,
        host: "127.0.0.1"
    }, {
        port: 8005,
        host: "127.0.0.1"
    }, {
        port: 8006,
        host: "127.0.0.1"
    }
], {
    scaleReads: "slave"
});

console.log('redis test start...');

cluster.set("foo", "bar");
cluster.get("foo", function (err, res) {

    console.log(err);
    
    console.log(res);

    // res === 'bar'
});

console.log('redis test end...');

setTimeout(() => {
    console.log(`timeout...`);
    
}, 10000);